Passed
Push — master ( 7aa1e4...a37cc0 )
by Kevin Van
05:30
created

Layout   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 35
dl 0
loc 40
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A componentDidMount 0 20 3
A render 0 16 1
1
// import './index.scss'
2
import $ from "jquery"
3
import React, { Component, Fragment } from "react"
4
import { forceCheck } from "react-lazyload"
5
6
import PageFooter from "../components/page-footer"
7
import PageHeader, { PageHeaderMobile } from "../components/page-header"
8
9
class Layout extends Component {
10
  render() {
11
    const { children } = this.props
12
13
    return (
14
      <Fragment>
15
        <div className={`off-canvas-wrapper`}>
16
          <PageHeaderMobile />
17
          <PageHeader />
18
19
          <main className={`off-canvas-content`} data-off-canvas-content>
20
            {children}
21
          </main>
22
23
          <PageFooter />
24
        </div>
25
      </Fragment>
26
    )
27
  }
28
29
  componentDidMount() {
30
    // eslint-disable-next-line
31
    const foundation = require("foundation-sites")
32
    $(document).foundation()
33
34
    $(`.main-nav a`).on(`click`, function () {
35
      if ($(this).attr(`href`).indexOf(window.location.pathname) === 0 && window.location.hash) {
36
        const url = $(this).attr(`href`)
37
        const hash = url.substring(url.indexOf(`#`))
38
39
        $(`.team-sub_navigation a[href="${hash}"]`).trigger(`click`, [true])
40
      }
41
    })
42
43
    if (window.location.hash) {
44
      $(`.team-sub_navigation a[href="${window.location.hash}"]`).trigger(`click`, [true])
45
    }
46
    $(`.tabs`).on(`change.zf.tabs`, function () {
47
      forceCheck()
48
    })
49
  }
50
}
51
52
export default Layout
53